using UnityEngine;
using System.Collections;

public class _Plataform : MonoBehaviour {
	
	public Vector2 size;
	public Texture texture;
	
	void Start () {
		
		gameObject.AddComponent("MeshRenderer");
		gameObject.AddComponent("MeshFilter");
		gameObject.AddComponent("BoxCollider");
	
		Mesh mesh = Quad.Create(size.x ,size.y );
		gameObject.GetComponent<MeshFilter>().mesh = mesh;
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Material");
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Transparent");
		gameObject.GetComponent<MeshRenderer>().material.mainTexture = texture;
		gameObject.GetComponent<BoxCollider>().size = new Vector3(size.x * 2 , size.y  * 2 , 1);

	}
	
	void Update () 
	{
		transform.Translate(_Speed.speed,0,0);
		
		if(transform.position.x < -40)
		{
			Destroy (gameObject);
		}
		
	}
	
	void OnCollisionEnter (Collision c)
	{
		if(c.gameObject.CompareTag("Player"))
		{
			_Player.f_basejump = 0;
			Debug.Log (_Player.f_basejump = 0);
		}
	}
	

}
